package com.example.software.service.impl;

import com.example.software.entity.SupportRequest;
import com.example.software.mapper.SupportRequestMapper;
import com.example.software.service.SupportService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;

@Service
@RequiredArgsConstructor
public class SupportServiceImpl implements SupportService {
    private final SupportRequestMapper supportRequestMapper;

    @Override
    public SupportRequest createRequest(SupportRequest request) {
        request.setCreatedAt(LocalDateTime.now());
        supportRequestMapper.insert(request); // 使用BaseMapper的insert方法
        return request;
    }

    @Override
    public List<SupportRequest> getAllRequests() {
        return supportRequestMapper.selectList(null);
    }

    @Override
    public void updateReply(Long id, String reply) {
        supportRequestMapper.updateReply(id, reply);
    }
}